<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core" jsfc="ui:composition"
	template="/general-template.xhtml">
<head>
<title jsfc="ui:define" name="title">Edit user settings - Simple
	User Management Module</title>
</head>
<body jsfc="ui:define" name="content">
	<h1>Edit user settings</h1>
	<h:panelGroup rendered="#{user.loggedIn}">
		<form jsfc="h:form" id="edituser">
			<h:panelGrid columns="2">
				<label jsfc="h:outputLabel" for="displayName">Change the
					display name</label>
				<input type="text" jsfc="h:inputText" id="displayName"
					value="#{user.displayName}" required="true" />
				<input type="submit" jsfc="h:commandButton" value="Submit"
					action="#{update.updateUserData}" />
				<h:messages showDetail="true" showSummary="false" />
			</h:panelGrid>
		</form>
		<h2>Edit groups</h2>
		<form id="editgroups-C" jsfc="h:form">
			<h:selectManyCheckbox id="groups" value="#{user.groups}" layout="pageDirection">
				<f:selectItems var="grp" value="#{update.allGroups}" itemValue="#{grp}"
					itemLabel="#{grp}" />
			</h:selectManyCheckbox>
			<h:commandButton value="Submit changes" action="#{update.updateGroups}"/>
		</form>
		<h2>Change your password</h2>
		<form jsfc="h:form" id="changepwd">
			<h:panelGrid columns="2">
				<label sjfc="h:outputLabel" for="pwd1">New password</label>
				<input type="password" jsfc="h:inputSecret" id="pwd1" value="#{pwd.pwd1}" redisplay="false" required="true" />
				<label sjfc="h:outputLabel" for="pwd2">Repeat password</label>
				<input type="password" jsfc="h:inputSecret" id="pwd2" value="#{pwd.pwd2}" redisplay="false" required="true" />
				<label sjfc="h:outputLabel" for="pwd">Your old password</label>
				<input type="password" jsfc="h:inputSecret" id="pwd" value="#{pwd.oldPwd}" redisplay="false" required="true" />
				<input type="submit" jsfc="h:commandButton" value="Change password" action="#{pwd.changePassword}" />
				<h:messages showDetail="true" showSummary="false" />
			</h:panelGrid>
		</form>
	</h:panelGroup>
	<h:panelGroup rendered="#{!user.loggedIn}">
		<p>You are not logged in.</p>
	</h:panelGroup>
</body>
</html>
